
/*    This file is part of the managarm operating system.
 *   Copyright (C) 2007, 2008, 2009  Alexander van der Grinten
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. */

package org.managarm.jmanaintlib.machine;

import org.managarm.jmanavalib.core.VaDatatype;
import org.managarm.jmanavalib.core.VaClsInfo;
import org.managarm.jmanavalib.core.VaMthInfo;
import org.managarm.jmanavalib.core.VaFldInfo;

public class VmCell {
	// operations returning the cell's value
	public long valueAsUInt() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public long valueAsChar() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public boolean valueAsBoolean() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public VmCell castTo(VaDatatype datatype) throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	
	// object operations
	public VaClsInfo getClsInfo() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public VmCell loadField(VaFldInfo field) throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName()
				+ " (Field: " + field.clsInfo.ident + ":" + field.ident + ")");
	}
	public void storeField(VaFldInfo field, VmCell cell) throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public long getIdentity() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	
	// array operations
	public VmCell loadElement(long index) throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public void storeElement(long index, VmCell cell) throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public long arraySize() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public void arrayCopy(VmCell source, long offset, long srcoff, long length)
			throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	
	// delegate operations
	public VaMthInfo delegateMethod() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
	public VmCell delegateObject() throws VmError {
		throw new VmError("Invalid operation for "
				+ getClass().getSimpleName());
	}
}
